//
//  HTPremiumPlanSection.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/8.
//

import SwiftUI

struct HTPremiumPlanSection: View {

  @Binding var var_curSubscribe: HTSubscribe?

  var body: some View {
    ZStack(alignment: .topLeading){
      Image("currentplan_bg")
        .resizable()
        .aspectRatio(contentMode: .fill)
        .frame(width: UIDevice.ht_screenWidth() - 20, height: 60)
      HStack{
        Image("currentplan")
          .resizable()
          .aspectRatio(contentMode: .fill)
          .frame(width: 104, height: 18)
        Spacer()
        VStack(alignment: .trailing){
          Text(var_curSubscribe?.var_title ?? "")
            .font(.system(size: 14))
            .fontWeight(.bold)
            .ht_normal()
          if var_curSubscribe?.var_auto_renew_status == 0 {
            Spacer().frame(height: 3)
            Text("Cancels on:\(var_curSubscribe?.var_expiredDate ?? "")")
              .font(.system(size: 12))
              .ht_normal()
          }
        }
      }
      .padding(.horizontal, 12)
      .padding(.vertical, 10)
      .frame(maxWidth: .infinity, maxHeight: .infinity)
    }
    .frame(width: UIDevice.ht_screenWidth() - 20, height: 60)
    .cornerRadius(6)
  }
}
